home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
DNA_XCMD
/
COMPLIME.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-01
|
1KB
|
42 lines
/* Compliment.c
A HyperCard XFCN that returns the compliment of a DNA sequence. It uses the base
conversion routine 'BaseComp.c' to map the individual bases; look there to find the
compliment function.
Molecular Genetics Laboratory, The Salk Institute
Division of Biology & Dept. of Comp. Sci, Washington University
America OnLine: Reece Internet: reece@informatics.wustl.edu
To compile (Think C):
1) Create project with this file, BaseComp.c, MacTraps, ANSI-A4, and HyperXLib.
2) Choose 'Set Project Type╔'. Select type 'Code Resource',
name 'Compliment', type 'XFCN', and ID '2000'.
3) Select 'Build Code Resource╔" from Project menu.
*/
#include <HyperXCmd.h>
#include "BaseComp.h"
#include "string.h"
#define NIL ((void *) 0)
pascal void main(XCmdPtr paramPtr)
{
Handle ReturnHdl;
register char *i, *j;
/* Allocate space that is as large as the incoming sequence + 1 for '\0'. If
allocation fails, we return a NIL handle. */
if ( (ReturnHdl = (Handle) NewHandle ((long) strlen(*paramPtr->params[0])+1)) != NIL )
{
for (i = *paramPtr->params[0], j = *(char **)ReturnHdl; *i; i++, j++)
*j = BaseCompliment(*i);
*j = '\0'; /* tack on the null at the end of the out-going sequence. */
}
paramPtr->returnValue = ReturnHdl;
}